package SearchStudent;

/**
 * @Author MDD
 * @Description
 * @Version
 * @Date
 **/
public class Student1 {
     String[] names = new String[20];

     public void addName(String name){
         for (int i = 0; i < names.length; i++) {
             if (names[i]==null){
                 names[i] = name;
                 break;
             }
         }
     }

     public boolean searchName(int start,int end,String name){
         boolean flag = false;
         for (int i = start-1; i < end; i++) {
             if (name.equals(names[i])){
                 return true;
             }
         }
         return false;
     }

     public void showName(){
         System.out.println("班级学员列表：");
         for (int i = 0; i < names.length; i++) {
             if (names[i]!=null){
                 System.out.println(names[i]+"\t");
             }
         }
     }
}
